/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nc.kyiv.yellow.sociallibrary.emails;

import javax.mail.MessagingException;

/**
 *
 * @author Виталий
 */
public class EmailSender {

    public void Confirmation(String ReceiverAddress, String ReceiverName, String ReceiverLogin, String ReceiverConfPage) {
        try {
            Email msg = new Email(ReceiverAddress, "Account Confirmation. SocialLibrary", "http://localhost:8080/Social_Library/email/confirmation.jsp?login=" + ReceiverLogin + "&name=" + ReceiverName + "&confpage=" + ReceiverConfPage);
            msg.sendEmail();
        } catch (Exception ex) {
        }
    }

    public void BookStatus(String ReceiverAddress, String ReceiverName, String Book, String Status) {
        try {
            Email msg = new Email(ReceiverAddress, "Book status. SocialLibrary", "/../emails/BookStatus.jsp?name=" + ReceiverName + "&book" + Book + "&status" + Status);
            msg.sendEmail();
        } catch (Exception ex) {
        }
    }

    public String Send(String rn, String s, String t) {
        Email msg = new Email(rn, s, t);
        try {
            msg.sendEmail();
            return "Email sent.";
        } catch (MessagingException ex) {
            return "MessagingException<br>" + ex.getMessage();
        }
    }
}
